﻿using DXApplicationTangche.service;
using DXApplicationTangche.UC.nlp.dto;
using mendian;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.nlp.service
{
    public class NlpService
    {
        /// <summary>
        /// 上传文件到nlp服务
        /// </summary>
        /// <param name="meta_key"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static String uploadFile(String meta_key,String fileName)
        {
            return
                FileService.UploadRequest(
                    ConnectUrl.接口url + "/nlp/upload?meta_key=" + meta_key,
                    fileName,
                    Path.GetFileName(fileName),
                    "uploadFile");

        }

        /// <summary>
        /// 根据关键字检索json
        /// </summary>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public static String getJSONByKeyword(String keyword)
        {
            return
                RestCall.httpGetMethod(
                    ConnectUrl.接口url + "/nlp/getJSONByKeyword?keyword=" + keyword
                );
        }
    }
}
